﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.TextManager.Interop;

namespace PowerGuiVsx.Core
{
    public class TextLineMarker : IVsTextLineMarker 
    {
        #region Implementation of IVsTextMarker

        /// <summary>
        /// Returns a text marker type.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        /// <param name="piMarkerType">[out] Pointer to integer value representing the marker type.
        ///                 </param>
        public int GetType(out int piMarkerType)
        {
            piMarkerType = 0;
            return VSConstants.E_NOTIMPL;
        }

        /// <summary>
        /// Sets a text marker type.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        /// <param name="iMarkerType">[in] Integer containing the marker type to be set.
        ///                 </param>
        public int SetType(int iMarkerType)
        {
            return VSConstants.E_NOTIMPL;
        }

        /// <summary>
        /// Returns the visual style of a marker type.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        /// <param name="pdwFlags">[out] Pointer to a DWORD for the visual style flags. For a list of <paramref name="pdwFlags"/> values, see <see cref="T:Microsoft.VisualStudio.TextManager.Interop.MARKERVISUAL"/>.
        ///                 </param>
        public int GetVisualStyle(out uint pdwFlags)
        {
            pdwFlags = (uint)MARKERVISUAL.MV_LINE;
            return VSConstants.S_OK;
        }

        /// <summary>
        /// Sets the visual style of a marker type.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        /// <param name="dwFlags">[in] DWORD for the visual style flags. For a list of <paramref name="pdwFlags"/> values, see <see cref="T:Microsoft.VisualStudio.TextManager.Interop.MARKERVISUAL"/>.
        ///                 </param>
        public int SetVisualStyle(uint dwFlags)
        {
            return VSConstants.S_OK;
        }

        /// <summary>
        /// Prevents a text marker from appearing in the user interface.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        public int Invalidate()
        {
            return VSConstants.E_NOTIMPL;
        }

        /// <summary>
        /// Draws a glyph in the widget margin given a display context and bounding rectangle.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        /// <param name="hdc">[in] Handle to a display device context that defines the visible region of interest for the glyph.
        ///                 </param><param name="pRect">[in] Pointer to a RECT structure, which defines the coordinates of the upper-left and lower-right corners of the bounding rectangle for the glyph.
        ///                 </param>
        public int DrawGlyph(IntPtr hdc, RECT[] pRect)
        {
            return VSConstants.E_NOTIMPL;
        }

        /// <summary>
        /// Returns the text to display in a tip for the marker type.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        /// <param name="pbstrText">[out] Pointer to the string containing the tip text for the marker type.
        ///                 </param>
        public int GetTipText(string[] pbstrText)
        {
            return VSConstants.E_NOTIMPL;
        }

        /// <summary>
        /// Unadvises the client, if there is one.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        public int UnadviseClient()
        {
            return VSConstants.E_NOTIMPL;
        }

        /// <summary>
        /// Returns text marker command information.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        /// <param name="iItem">[in] Integer identifying the item number for a marker type's context menu command. Values typically range from 0 to 9, but the marker type may also support command values 101 through 103. For more information about these command values, see <see cref="T:Microsoft.VisualStudio.TextManager.Interop.MarkerCommandValues"/>.
        ///                 </param><param name="pbstrText">[out] Pointer to a string identifying the marker type command text for the context menu.
        ///                 </param><param name="pcmdf">[out] Specifies command flags.
        ///                 </param>
        public int GetMarkerCommandInfo(int iItem, string[] pbstrText, uint[] pcmdf)
        {
            return VSConstants.E_NOTIMPL;
        }

        /// <summary>
        /// Executes a text marker against a text marker.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        /// <param name="iItem">[in] Integer identifying the item number for a marker type's context menu command. Values typically range from 0 to 9, but the marker type may also support command values 101 through 103.
        ///                 </param>
        public int ExecMarkerCommand(int iItem)
        {
            return VSConstants.E_NOTIMPL;
        }

        /// <summary>
        /// Returns a text marker behavior set by the <see cref="M:Microsoft.VisualStudio.TextManager.Interop.IVsTextMarker.SetBehavior(System.UInt32)"/> method.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        /// <param name="pdwBehavior">[out] Pointer to a DWORD containing the behavior for the marker type. For a list of <paramref name="pdwBehavior"/> values, see <see cref="T:Microsoft.VisualStudio.TextManager.Interop.MARKERBEHAVIORFLAGS"/>.
        ///                 </param>
        public int GetBehavior(out uint pdwBehavior)
        {
            pdwBehavior = 0;
            return VSConstants.E_NOTIMPL;
        }

        /// <summary>
        /// Sets the behavior of a text marker.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        /// <param name="dwBehavior">[in] Pointer to a DWORD containing the behavior for the marker type. For a list of <paramref name="pdwBehavior"/> values, see <see cref="T:Microsoft.VisualStudio.TextManager.Interop.MARKERBEHAVIORFLAGS"/>.
        ///                 </param>
        public int SetBehavior(uint dwBehavior)
        {
            return VSConstants.S_OK;
        }

        /// <summary>
        /// Returns the text marker priority index, with the highest value getting the topmost placement.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        /// <param name="piPriorityIndex">[out] Pointer to an integer containing the priority index. For a list of <paramref name="piPriorityIndex"/> values, see <see cref="T:Microsoft.VisualStudio.TextManager.Interop.MARKERTYPE"/>.
        ///                 </param>
        public int GetPriorityIndex(out int piPriorityIndex)
        {
            piPriorityIndex = 0;
            return VSConstants.E_NOTIMPL;
        }

        #region Implementation of IVsTextLineMarker

        /// <summary>
        /// Provides access to an associated text buffer.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        /// <param name="ppBuffer">[out] Pointer to the <see cref="T:Microsoft.VisualStudio.TextManager.Interop.IVsTextLines"/> interface of the associated buffer.
        ///                 </param>
        public int GetLineBuffer(out IVsTextLines ppBuffer)
        {
            ppBuffer = null;
            return VSConstants.E_NOTIMPL;
        }

        /// <summary>
        /// Resets the position of the text marker.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        /// <param name="iStartLine">[in] Line containing the beginning of the text marker.
        ///                 </param><param name="iStartIndex">[in] Starting character index for the text marker within the line. This value must be less than or equal to the length of line.
        ///                 </param><param name="iEndLine">[in] Line containing the end of the text marker.
        ///                 </param><param name="iEndIndex">[in] Ending character index for the text marker within the line. This value must be length of line.
        ///                 </param>
        public int ResetSpan(int iStartLine, int iStartIndex, int iEndLine, int iEndIndex)
        {
            return VSConstants.E_NOTIMPL;
        }

        /// <summary>
        /// Returns the current position of the text marker.
        /// </summary>
        /// <returns>
        /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code.
        /// </returns>
        /// <param name="pSpan">[out] Pointer to the range of text that the marker covers. The text span for a marker is a set of two [line, index] coordinates. This structure is allocated by the caller.
        ///                 </param>
        public int GetCurrentSpan(TextSpan[] pSpan)
        {
            pSpan[0] = default(TextSpan);
            return VSConstants.S_OK;
        }

        #endregion

        #endregion
    }
}
